$(function(){
	  //给单击按钮追加处理
	  $("#login").click(function(){
           //清除原有的信息
           $("#count_msg").html("");
           $("#password_msg").html("");
		  //获取请求数据
		  var username = $("#count").val().trim();
		  var password = $("#password").val().trim();
		  //检查数据格式
		  if(username == ""){
			  $("#count_msg").html("用户名不能为空"); 
			  return;
		  }
		  if(password==""){
			  $("#password_msg").html("密码不能为空");
			  return;
		  }
		  //发送请求
		  $.ajax({
			  url:"http://localhost:8080/cloud_note/user/login.do",
			  type:"post",
			  data:{"username":username,"password":password},
			  dataType:"json",
			  success:function(result){
				 if(result.status == 0){//成功
					//获取用户id,写入Cookie
					var userId = result.data;//客户端获取到登录用户的userId
				    addCookie("uid",userId,2);//存储两小时
					window.location.href = "http://localhost:8080/cloud_note/edit.html";//JS语言实现页面跳转 
				 }else if(result.status==1){
					$("#count_msg").html(result.msg);
				 }else{
					$("#password_msg").html(result.msg);
				 }
			  }
		  });
	  });
  });